home *** CD-ROM | disk | FTP | other *** search
- Path: news.vf.mmc.com!usenet
- From: Paul Blust <blustp>
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Has Anyone Tried to Mix SunAda (Rational) and Sun SPARCWORKS C++?
- Date: 1 Feb 1996 20:00:32 GMT
- Organization: Lockheed Martin Corp, Valley Forge PA
- Message-ID: <4er650$mv8@morgan.vf.mmc.com>
- NNTP-Posting-Host: e7sm03.epi.syr.ge.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.4 sun4c)
- X-URL: news:comp.lang.ada
-
- I'm trying to combine Ada and C++ code using the Rational VADSself (6.2.3(b))
- and the Sun SPARCWORKS C++ (4.0.1) compilers on a Sun SPARC workstation. This
- works if the C++ code is very simple, but when I try to use C++ classes or
- exceptions, I get a segmentation fault at startup.
-
- Most of the attempts I've made have used Ada as the top level program, but I've
- also tried making C++ the top level. With Ada as the top-level, I've tried
- calling "_cinit_" to initialize the C++ runtime environment. When C++ is the
- top level, I've tried calling "__start" to initialize the Ada runtime
- environment. None of these have worked.
-
- It appears that either something in the C++ run-time environment is not being
- set up properly, or something in the two run-time environments conflict.
-
- Here is the test Ada program I used:
-
- procedure TEST1 is
- procedure MAIN;
- pragma INTERFACE(C,MAIN);
- pragma INTERFACE_NAME(MAIN,"main");
- begin
- MAIN;
- end;
-
- Here is the test C++ program called by Ada:
-
- #include<stdio.h>
- extern "C"
- { int main(); }
-
- class test_exception{};
- int main()
- {
- try { throw test_exception(); }
- catch (test_exception)
- {
- printf("Test Exception successfully caught\n");
- }
- return(0);
- }
-
- When I compile this and run, I get a Segmentation Fault. I have similar
- problems if I try to use C++ classes instead of exceptions. The segmentation
- fault occurs either way.
-
- Has anyone encountered this problem? Any suggestions as to how to solve it?
-
- Paul Blust (blustp@epi.syr.ge.com)
-
-